#include "MapScene.h"
#include "AppMacros.h"
//USING_NS_CC;

using namespace cocos2d;

bool MapScene::init()
{
	if( CCScene::init() )
	{
		this->_layer = MapLayer::create();
		this->_layer->retain();
		this->addChild(_layer);
		
		return true;
	}
	else
	{
		return false;
	}
}

MapScene::~MapScene()
{
	if (_layer)
	{
		_layer->release();
		_layer = NULL;
	}
}

bool MapLayer::init()
{
    if ( !CCLayer::init() )
    {
        return false;
    }
	
    
    CCSize visibleSize = CCDirector::sharedDirector()->getVisibleSize();
    CCPoint origin = CCDirector::sharedDirector()->getVisibleOrigin();

    // add "HelloWorld" splash screen"
    CCSprite* pSprite = CCSprite::create("map.jpg");

    // position the sprite on the center of the screen
    pSprite->setPosition(ccp(visibleSize.width/2 + origin.x, visibleSize.height/2 + origin.y));

    // add the sprite as a child to this layer
    this->addChild(pSprite, 0);

	return true;    
}

MapLayer::~MapLayer()
{
/*
	if (_label)
	{
		_label->release();
		_label = NULL;
	}
*/
}
